package com.youmingxing.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import java.util.HashMap;
import java.util.Iterator;

/**
 * JHS
 */
public class ActivityJump {
    /****
     * Activity  跳转完不Finish
     * ***/
    public static void getInsanceJump(Context mContext, Class mClass, HashMap<String, String> intentExtra) {
        Intent mIntent = new Intent();
        if (intentExtra != null) {
            Iterator it = intentExtra.keySet().iterator();
            while (it.hasNext()) {
                String key = (String) it.next();
                String value = (String) intentExtra.get(key);
                mIntent.putExtra(key, value);
            }
        }
        mIntent.setClass(mContext, mClass);
        mContext.startActivity(mIntent);
    }

    /****
     * Activity  跳转完 消失  Finish
     * ***/
    public static void getInsanceJump(Activity mContext, Class mClass, HashMap<String, String> intentExtra, boolean isActivityFinish) {
        Intent mIntent = new Intent();
        if (intentExtra != null ) {
            Iterator it = intentExtra.keySet().iterator();
            while (it.hasNext()) {
                String key = (String) it.next();
                String value = (String) intentExtra.get(key);
                mIntent.putExtra(key, value);
            }
        }
        mIntent.setClass(mContext, mClass);
        mContext.startActivity(mIntent);
        mContext.finish();
    }
}
